<template>
	<div id="setActivity"
		v-loading="fetchLoading"
		element-loading-text="拼命加载中..">
		<div class="content-box">
			<div class="content-title">
				<ul>
					<li><i class="fa fa-check-circle" aria-hidden="true"></i>新建活动</li>
					<li class="linebox"></li>
					<li><i class="fa fa-check-circle" aria-hidden="true"></i>选择模板</li>
					<li class="linebox"></li>
					<li class="active"><i class="fa fa-check-circle" aria-hidden="true"></i>活动设置</li>
				</ul>
			</div>
			<div class="set-box">
				<!-- 左边手机模拟窗口 -->
				<div class="set-left">
					<div class="window-title">{{form.activityName}}</div>
					<div class="window-content" :style="{'background-image': 'url('+form.bgImg+')'}">
						<!-- banner -->
						<div class="window-banner">
							 <img :src="bannerItem.imgUrl" v-show="bannerItem.imgUrl" v-for="bannerItem in showBanner">	 
						</div>
						
						<!-- 分享弹框 -->
						<div class="window-share-mask" v-show="form.shareSwitch&&currentTab==2">
							<div class="window-share-box">
								<p>{{form.shareTitle}}</p>
								<div>{{form.shareContent}}</div>
								<img :src="form.shareIcon" v-show="form.shareIcon">
							</div>
						</div>
					</div>
				</div>
				<div class="set-right">
					<div class="set-content clear-both"  >
						<div class="set-tab clearfix">
							<div v-for="(item,index) in tabData"
								 class="tab-item"
								 :class="{'active': currentTab == index}"
								 @click="tabClickEvent(index)">{{item}}</div>
						</div>

						<!-- 内容设置 -->
						<div  class="tab-content" v-show="currentTab==0">
							<div class="form-item-box clearfix">
								<div class="form-item-left require-item">活动名称:</div>
								<div class="form-item-right">
									<input type="text" maxlength="50" v-model="form.activityName">
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left require-item">活动时间:</div>
								<div class="form-item-right pick-date-box">
									<el-date-picker
								      v-model="form.activityStartTime"
								      type="datetime"
									  :picker-options="pickerOptions"
								      placeholder="选择开始时间">
								    </el-date-picker><span class="separate-box">至
								    </span><el-date-picker
								      v-model="form.activityEndTime"
								      type="datetime"
									  :picker-options="pickerOptions"
								      placeholder="选择结束时间">
								    </el-date-picker>
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left require-item">抽奖次数:</div>
								<div class="form-item-right lotteryNum-box">
									<span class="separate-box float-left">每人可抽奖
								    </span><input class="input-lottery float-left" type="text" min="1" v-model="form.lotteryNum" ><el-select v-model="form.tagDetailValue" class="float-left">
									    <el-option
									      	v-for="item in lotteryNumOptions"
									      	:key="item.value"
									      	:label="item.label"
									      	:value="item.value">
									    </el-option>
									  </el-select>
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left default-banner-name">自定义配置项:</div>
								<div class="form-item-right default-banner">
									<el-select v-model="customValue" @change="customChange" multiple placeholder="请选择">
										<el-option
										v-for="item in customOptionItem"
										:key="item.value"
										:label="item.label"
										:value="item.value">
										</el-option>
									</el-select>
								</div>
							</div>
							<div class="form-item-box clearfix" v-show="defaultBanner">
								<div class="form-item-left default-banner-name">默认Banner图:</div>
								<div class="form-item-right default-banner">
									<img :src="defaultBanner">
								</div>
							</div>
							<div class="form-item-box clearfix" v-show="customValue.indexOf('Banner图')!=-1">
								<div class="form-item-left">Banner图:</div>
								<div class="form-item-right add-banner">
								<p style="display:inline-block;margin:5px 10px;" v-for="(imgItem,imgindex) in form.bannerImg">
									<span class="add-banner-btn" 
										v-show="!imgItem.imgUrl"
										@click="showUploadPicToast(0,imgindex)">+</span>
									<img v-show="imgItem.imgUrl" :src="imgItem.imgUrl" />
									<i class="fa fa-times" 
										aria-hidden="true"
										@click="cancelBanner(0,imgindex)"></i>
								</p>
									
									<span><el-button @click="addBannerImg">新增banner</el-button></span>   
									<p>宽高2:1的图片，支持PNG、JPG格式，小于100KB</p>
								</div>
								
							</div>
							<div class="form-item-box clearfix" >
								<div class="form-item-left">背景图:</div>
								<div class="form-item-right add-banner">
									<span class="add-banner-btn" 
										  v-show="!form.backgroundImg"
										  @click="showUploadPicToast(3)">+</span>
									<img v-show="form.backgroundImg" :src="form.backgroundImg" />
									<i class="fa fa-times" 
									   aria-hidden="true"
									   v-show="form.backgroundImg"
									   @click="cancelBanner(3)"></i>
									<p>640*1200像素，支持PNG、JPG格式，小于200KB</p>
								</div>
							</div>
						<!--	<div class="form-item-box clearfix">
								<div class="form-item-left tag-name">活动标签:</div>
								<div class="form-item-right tag-box">
									<el-select v-model="form.tagValue" placeholder=" ">
									    <el-option
									      v-for="item in tagOptions"
									      :key="item.value"
									      :label="item.label"
									      :value="item.value">
									    </el-option>
									</el-select>
								</div>
							</div>-->
							<div class="form-item-box clearfix last-item">
								<div class="form-item-left require-item">活动规则:</div>
								<div class="form-item-right rule-box">
							      	<quill-editor 
							      		  v-model="form.activityRules"
							              ref="myQuillEditor"
							              class="editer"
							              :options="editorOption"
							              @ready="onEditorReady($event)">
									</quill-editor>
								</div>
							</div>
						</div>
						
						<!-- 奖品设置 -->
						<div class="tab-content" v-show="currentTab==1">
							<div class="prize-set-box">
								<ul class="prize-set-head">
									
									<li class="prize-list">奖项</li>
									<li class="prize-img">图片</li>
									<li class="prize-name">名称(库存)</li>
									<!--<li class="list-icon">&nbsp;</li>-->
									<el-tooltip class="item" effect="dark" content="限制每一个用户最多能抽中该奖品多少次,填0表示不限制" placement="top-start">
										<li class="winning-limit">中奖限制</li>
									</el-tooltip>
									<el-tooltip class="item" effect="dark" content="最小可设置为0,最大不能超过170,如果为0,可能是因为其他活动使用该奖品,占用了库存" placement="top-start">
										<li class="stock">数量限制</li>	
									</el-tooltip>
									<el-tooltip class="item" effect="dark" content="注:所有奖品概率总和不能大于100%" placement="top-start">
										<li class="winning-probability">中奖概率(%)</li>	
									</el-tooltip>
									<li class="operation">操作</li>
									<li class="operation all-prize-config">中奖通知</li>
								</ul>
								<div class="prize-set-content">
									<ul v-for="(item, index) in pickedPrizeList"
										 v-dragging="{ item: item, list: pickedPrizeList, group: 'item' }"
										:key="index">
										<!--<li class="list-icon move-cursor"><i class="fa fa-arrows" aria-hidden="true"></i></li>-->
										<li class="prize-list">{{index+1}}</li>
										<li class="prize-img"><img :src="item.background_image"></li>
										<li class="prize-name">{{item.name}}({{item.stock_number}})</li>
										
										<li class="winning-limit limit-item">
											<el-input  min="0" v-model="item.winningLimit" @blur="changeLimitInput(1,item)" class="input" placeholder="中奖限制"></el-input>
										</li>
										<li class="stock limit-item">
										<el-input  min="0" :max="item.stock_number" v-model="item.numLimit" @blur="changeLimitInput(2,item)" class="input" placeholder="数量限制"></el-input>
										</li>
										<li class="winning-probability limit-item">
										
										<el-input  min="0" max="100" v-model="item.probabLimit" @blur="changeLimitInput(3,item)" class="input" placeholder="中奖概率"></el-input>
										</li>
										<li class="operation">
											<!--<i class="fa fa-pencil-square-o" 
											   aria-hidden="true"></i>-->
										<el-tooltip class="item" effect="dark" content="删除" placement="top-start">
											<i class="fa fa-trash-o" 
											   aria-hidden="true"
											   @click="deletePickedPrize(item,index)"></i>
										</el-tooltip>
											
										</li>
										<li class="operation all-prize-config">
											<!--<el-checkbox v-model="item.winInform"></el-checkbox>-->
											通知
										</li>
									</ul>
								</div>

								<div class="prize-set-footer clear-both">
								<!--<i class="fa fa-arrows" aria-hidden="true"></i>拖拽可以对奖项进行排序<i class="fa fa-info-circle exclamatory" aria-hidden="true"></i>本模板添加奖品数量<span>1</span> ～ <span>20</span>个。-->
										<div class="footer-btn float-right"
										@click="showAddPrizeToast">添加奖品</div>
								</div>
							</div>

							<!--<div class="special-rule-set">
								<h4 class="rule-title">特殊规则设置
									<el-switch
									  v-model="form.specialRuleSwitch"
									  active-color="#64bd63"
									  inactive-color="#ffffff">
									</el-switch>
									<span v-show="form.specialRuleSwitch"
										  @click="addSpecialRule">+新增</span>
								</h4>
								<div class="rule-content" v-show="form.specialRuleSwitch">
									<p v-show="specialRuleData.length === 0">你可以点击右上角的<span> +新增 </span>按钮添加特殊规则</p>
									<div class="special-item" v-for="(item, index) in specialRuleData">
										<span>每个用户在</span>
										<el-date-picker
									      v-model="item.startTime"
									      type="datetime"
										  :picker-options="pickerOptions"
									      placeholder="选择开始时间">
									    </el-date-picker><span class="separate-box">至
									    </span><el-date-picker
									      v-model="item.endTime"
									      type="datetime"
										  :picker-options="pickerOptions"
									      placeholder="选择结束时间">
									    </el-date-picker>
										<span>100%抽中</span>
										<el-select v-model="item.prizeOptionValue">
										    <el-option
										      v-for="item in prizeOptions"
										      :key="item.value"
										      :label="item.label"
										      :value="item.value">
										    </el-option>
										</el-select>
										<input class="special-num" v-model="item.prizeNum" type="text">
										<span>次</span>
										<i class="fa fa-trash-o" 
										   aria-hidden="true"
										   @click="deleteSpecialRule(item,index)"></i>
									</div>
								</div>
							</div>-->
						</div>

						<!-- 拉新设置 -->
						<div class="tab-content" v-show="currentTab==2">
						<!-- 发布到APP -->
							<div class="form-item-box clearfix">
								<div class="form-item-left code-left title-channel">发布到APP:</div>
								<div class="form-item-right code-switch">
									<el-switch
									  v-model="form.implantApp"
									  active-color="#64bd63"
									  inactive-color="#ffffff">
									</el-switch>
								</div>
							</div>
							<div class="form-item-box clearfix" v-show="form.implantApp">
								<div class="form-item-left require-item">APP下载链接:</div>
								<div class="form-item-right">
									<input type="text" v-model="form.appDownloadUrl">
								</div>
							</div>
							<!-- 发布到微信 -->
							<div class="form-item-box clearfix">
								<div class="form-item-left code-left title-channel">发布到微信:</div>
								<div class="form-item-right code-switch">
									<el-switch
										v-model="form.implantWechat"
										active-color="#64bd63"
										inactive-color="#ffffff"
										@change="openImplantWx"
									  >
									</el-switch>
								</div>
							</div>
							<div class="form-item-box clearfix" v-show="form.implantWechat">
								<div class="form-item-left  code-left">上传二维码:</div>
								<div class="form-item-right add-banner">
									<span class="add-banner-btn"
									v-show="!form.wxCodeShow"
									@click="showUploadPicToast(1)">+</span>
									<img v-show="form.wxCodeShow" :src="form.wxCodeShow" />
									<i class="fa fa-times" 
									aria-hidden="true"
									v-show="form.wxCodeShow"
									@click="cancelBanner(1)"></i>
									<p>宽高1:1，支持PNG、JPG格式，小于20KB</p>
								</div>
							</div>
							    <!-- 绑定appid -->
							<el-dialog
								title="您还未授权公众号，是否现在授权？"
								:visible.sync="dialogVisible"
								size="tiny">
								<div>*授权公众号后才可支持活动在微信端发布参与，授权后，用于授权的公众号将无法与其他三方应用平台对接</div>
								<div class="input-box">
										<div class="title">授权绑定：</div>
										<el-input class="element-input" placeholder="请输入内容" v-model="wxForm.app_id">
											<template slot="prepend">APP_ID</template>
										</el-input>
										<el-input class="element-input" placeholder="请输入内容" v-model="wxForm.app_secret">
											<template slot="prepend">SecurityKey</template>
										</el-input>
								</div>
								<span slot="footer" class="dialog-footer">
									<el-button @click="dialogVisible = false">取 消</el-button>
									<el-button type="primary" @click="handleClose">确 定</el-button>
								</span>
							</el-dialog>
							<!-- 开启分享 -->
							<div class="form-item-box clearfix">
								<div class="form-item-left code-left title-channel">开启分享:</div>
								<div class="form-item-right code-switch">
									<el-switch
									  v-model="form.shareSwitch"
									  active-color="#64bd63"
									  inactive-color="#ffffff">
									</el-switch>
								</div>
							</div>
							<div v-show="form.shareSwitch">
								<div class="form-item-box clearfix">
									<div class="form-item-left require-item">分享图标:</div>
									<div class="form-item-right add-banner">
										<span class="add-banner-btn"
											v-show="!form.shareIcon"
											@click="showUploadPicToast(2)">+</span>
										<img v-show="form.shareIcon" :src="form.shareIcon" />
										<i class="fa fa-times" 
										aria-hidden="true"
										v-show="form.shareIcon"
										@click="cancelBanner(2)"></i>
										<p>宽高1:1，支持PNG、JPG格式，小于200KB</p>
									</div>
								</div>
								<div class="form-item-box clearfix">
									<div class="form-item-left require-item">分享标题:</div>
									<div class="form-item-right">
										<input type="text" v-model="form.shareTitle" placeholder="最多32个字">
									</div>
								</div>
								<div class="form-item-box clearfix">
									<div class="form-item-left require-item">分享文案:</div>
									<div class="form-item-right textarea-box">
										<textarea placeholder="最多50个字" v-model="form.shareContent"></textarea>
									</div>
								</div>
								<!--<div class="form-item-box clearfix">
									<div class="form-item-left">被分享者:</div>
									<div class="form-item-right use-info-box">
										引导被分享者关注二维码后参与<span>使用说明</span>
									</div>
								</div>-->
							</div>
							
							
						</div>

						<!-- 信息备注 -->
						<div class="tab-content" v-show="currentTab==3">
							<h6>只供商家做相关活动信息的备注，不显示在用户界面上</h6>
							<div class="form-item-box clearfix">
								<div class="form-item-left">活动ID:</div>
								<div class="form-item-right">
									<input type="text" v-model="form.activityInfoId">
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left">组织方:</div>
								<div class="form-item-right">
									<input type="text" v-model="form.organizerInfo">
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left">活动备注:</div>
								<div class="form-item-right textarea-box textarea-note-box">
									<textarea v-model="form.activityInfoNote"></textarea>
								</div>
							</div>
							<div class="form-item-box clearfix">
								<div class="form-item-left">其他:</div>
								<div class="form-item-right textarea-box textarea-note-box">
									<textarea v-model="form.activityInfoRests"></textarea>
								</div>
							</div>
						</div>

						<!-- 列表配置 -->
						<div class="tab-content clear-both" v-show="currentTab==4">
							<h6>列表配置仅限使用列表模式使用，如不需要使用列表模式请忽略此设置</h6>
							<div class="form-item-left" :class="{'require-item':form.implantApp}">列表缩略图:</div>
							<div class="form-item-right add-banner">
								<span class="add-banner-btn"
									v-show="!form.listThumbnailIcon"
									@click="showUploadPicToast(4)">+</span>
								<img v-show="form.listThumbnailIcon" :src="form.listThumbnailIcon" />
								<i class="fa fa-times" 
								aria-hidden="true"
								v-show="form.listThumbnailIcon"
								@click="cancelBanner(4)"></i>
								<p>支持PNG、JPG格式，小于200KB</p>
							</div>
						</div>
						<div class="set-bottom" >
							<el-button  class="save-btn" @click="saveContentSet">{{subText}}</el-button>
						</div>
						
					</div>
				</div>
			</div>
		</div>

		<!-- 添加奖品弹框 -->
		<div class="add-prize-mask" v-if="addPrizeBox">
			<div id="add-prize-box">
				<div class="add-prize-header">
					<el-input placeholder="请输入奖品名称进行搜索" v-model="availableForm.q">
					    <el-button slot="append" @click.native="searchPriceList"><i class="fa fa-search" aria-hidden="true"></i></el-button>
					</el-input>
					<!--<div class="refresh-btn">刷新</div>-->
					<span class="close" @click="hideAddPrizeToast"></span>
				</div>
				<div class="add-prize-body"  style="height: 340px; overflow: auto;">
					<div class="table-header">
						<table>
							<thead>
								<tr>
									<td>奖品名称</td>
									<td>类型</td>
									<td>有效期</td>
									<td>可用/库存</td>
									<td>操作</td>
								</tr>
							</thead>
						</table>
					</div>
					<div class="table-body">
						<table v-if="prizeList.length!=0">
							<tbody>
								<tr v-for="(item,index) in prizeList" v-show="item.availables>0">
									<td>{{item.name}}</td>
									<td>{{item.type_code | typeCode}}</td>
									<td>{{item.expired_start }}<br/>{{item.expired_end }}</td>
									<td>{{item.availables}}/{{item.stock_number}}</td>
									<td>
										<div class="pick-btn"
											@click="pickPrize(item,index)">选取</div>
									</td>
								</tr>
							</tbody>						
						</table>
						<div class="text-hit" v-else>暂无数据</div>					
					</div>
				</div>
				<div class="add-prize-footer">
					<div class="page-inner">
						<el-pagination
							small
							layout="prev, pager, next"
							:total="availableForm.total"
							@current-change="selectPrize"
							>
						</el-pagination>
					</div>
				</div>
			</div>
		</div>

		<!-- 上传图片弹框 -->
		<div class="add-prize-mask" v-if="uploadPicBox">
			<div 
				id="upload-pic-box" 
				v-loading="imgUpLoading"
				:element-loading-text="imgUpLoadingText"
				>
				<div class="add-prize-header">
					上传图片
					<span class="upload-close" @click="hideUploadPicToast"></span>
				</div>
				<div class="upload-body">
					<ul class="clearfix upload-img-list">
						<li><input type="file" 
							       @change='addImgEvent'
							       accept="image/png, image/jpeg, image/jpg">
						</li>
						<!--<li v-for="(item, index) in uploadPicList"
							@click="chooseBannerImg(index)"
							:class="{'border-red': currentBannerIndex===index}"
						    :style="{'background-image': 'url('+item.src+')'}"></li>-->
					</ul>
				</div>
				<div class="add-prize-footer">
					<div class="page-inner upload-page-inner">
						<div style="display:inline-block;">
							<el-pagination
								small
								layout="prev, pager, next"
								:total="updateImgtotal"
								@current-change="pageChange"
								>
							</el-pagination>
						</div>
						
						<el-button @click="hideUploadPicToast">取消</el-button>
						<el-button type="primary" @click="comfirmBannerImg">确定</el-button>
					</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
	import { quillEditor } from 'vue-quill-editor'
	import { baseImgPath } from './../config/env'
	import * as api from './../api/api';
	import Vue from 'vue'
	import { Message,Loading} from 'element-ui';    
	export default {
		data(){
			return {
				fetchLoading:false,  
				imgUpLoading:false,  //图片上传加载
				imgUpLoadingText:'上传中',
				// defaultBanner: require('../assets/img/banner.png'),
				pickerOptions: {
					disabledDate(time) {
						return time.getTime() < Date.now() - 8.64e7;
					}
				},
				defaultBanner: '',
				form: {
					tplModelId:'',  //模板id
					model_id:'',//模型id
					activityNo:'', //活动id
					//内容设置
					activityName:'',//活动名称
					activityStartTime: '',    //活动开始时间
					activityEndTime: '',   //活动结束时间
					lotteryNum: 1,    //抽奖次数
					tagDetailValue: 'all',  //活动次数方式
					bannerImg: [],  
					activityRules:'', //活动规则
					//奖品设置
					// winningLimit:0, //中奖限制
					// numLimit:0, //数量限制
					// probabLimit:0, //中奖概率
					// winInform:false, //通知中奖
					//信息备注
					activityInfoId:'', //活动id
					organizerInfo: '',// 活动组织方
					activityInfoNote:'', //活动备注
					activityInfoRests:'', //其他

					// bgImg: require('../assets/img/bg.jpg'),  //整个背景图
					bgImg: '',  //背景图  显示的
					backgroundImg:'',//背景图  上传的
					//拉下设置
					implantApp:false, //发布的app
					appDownloadUrl:'',//app下载链接
					implantWechat:false, //发布到微信
					wxCodeShow:'',
					// wxCodeImg:'', //分享的二维码

					// tagValue: '',
					shareSwitch: false,   //是否开启分享
					shareTitle: '',    //分享标题
					shareIcon: '',    //分享的图片
					shareContent: '',    //分享文案

					specialRuleSwitch: false,
					prizeOptionValue: '0',
					//列表配置
					listThumbnailIcon:'', //列表缩略图
				},
				customOptionItem:[
					{ value: 'Banner图', label: 'Banner图' },
					// { value: '广告图', label: '广告图' }
				],
				customValue:'',  //自定义配置项
				custoItemText:'',
				// 微信授权绑定
				wxForm:{
					app_id:'',
					app_secret:'',
					type:"normal"
				},
				dialogVisible: false,  //绑定appid弹出框
				isWXAppId:false,   //是否绑定appid
				clickUpLoadImg:0,   //判断当前点击的上传框
				bannerImgClickIndex:null,  //当前点击上传的banner图
				// //选择奖品分页
				// selectprizecurrent_page:1, //当前页码
                // selectprizelast_page:'',//最后一页
                // selectprizelimit:10, //一页显示多少条
                // selectprizetotal:1, //总条数

				//上传图片分页
				updateImgcurrent_page:1, //当前页码
                updateImglast_page:'',//最后一页
                updateImglimit:10, //一页显示多少条
                updateImgtotal:1, //总条数

				lotteryNumOptions: [{
		          value: 'all',
		          label: '次/活动全程'
		        },{
		          value: 'day',
		          label: '次/每日'
		        }],
				// tagOptions: [{
		        //   value: '2',
		        //   label: '吃货一族'
		        // },{
		        //   value: '3',
		        //   label: '旅行达人'
		        // },{
		        //   value: '4',
		        //   label: '职场新人'
		        // },{
		        //   value: '5',
		        //   label: 'IT达人'
		        // },{
		        //   value: '6',
		        //   label: '数码一族'
		        // }],
		        prizeOptions: [],
				
			    editorOption: {
			        
		        },
		        tabData: ['内容设置','奖品设置','拉新设置','信息备注','列表配置'],
		        currentTab: 0,  //tabs
				isTabContentShow:false,  //内容设置是否提交成功,提交成功后开始设置奖品拉新等信息
				// isTabListShow:false, //保存选择的奖品后，开始设置其他选项
				subText:'下一步',  //完成按钮提示文字
		        specialRuleData: [],
		        addPrizeBox: false,
		        pickedPrizeList: [],  //选中的奖品列表
				postNum:'',   //选择的奖品数量
		        prizeList: [],   //获得所有的奖品列表
		        uploadPicList:[
		        	{
		        		src: require('../assets/img/1.png')
		        	},{
		        		src: 'https://act.huodonghezi.com/templates_new/new_thanksgiving_day/assets/image/banner.png'
		        	}
		        ],
		        currentBannerIndex: -1,
		        uploadPicBox: false,

				//获得奖品列表
				availableForm:{
					per_page:15,  //一页显示多少条
					last_page:1,    //总共好多页面
					page:1,   //当前第几页
					q:'',	//搜索
					total:''
				},
				// contentLoading:false,

			}
		},
		watch:{
			currentTab(v,n){
				v==this.tabData.length-1?this.subText='完成':this.subText='下一步'
			},
			pickedPrizeList(v,n){
				this.postNum=this.pickedPrizeList.length;
			}
		},
		mounted(){
			let vm =this;
			//  globalEvent.$on('GetUpLoading',function(result){
			// 	 let complete = (result.loaded / result.total * 100 | 0);
			// 	 console.log(complete);
			// 	vm.imgUpLoadingText='上传中';
			// });
			this.$dragging.$on('dragged', ({ value }) => {
				// console.log(value.item)
				// console.log(this.pickedPrizeList);
				// console.log(value.list)
			});
			
			this.getAvailable();//获得奖品列表
			this.getIsWXAppId();  //判断是否绑定微信appid
		},
		components: {
			quillEditor
		},
        computed: {
          	editor() {
	        	return this.$refs.myQuillEditor.quill;
	      	},
	      	showBanner(){
				var banner=[];
				if(this.defaultBanner){
					if((this.form.bannerImg.length==1&&this.form.bannerImg[0].imgUrl=='')||this.form.bannerImg.length==0){
						banner=this.form.bannerImg.push({imgUrl:this.defaultBanner});
					}	
				}else{
					banner=this.form.bannerImg;
				}  
	      		return banner;
	      	}
        },
        methods: {
			//保存内容设置
			saveContentSet(){
				let vm = this;
				if(!vm.isTabContentShow&&vm.currentTab==0){
					if(vm.contentSetReg()){
						// vm.contentLoading=false;
						if(!vm.form.backgroundImg){
							vm.form.backgroundImg=vm.form.bgImg;
						}
						let bannerImgList=[];
						vm.form.bannerImg.forEach((item,index)=>{
							if(item.imgUrl){
								bannerImgList.push(item.imgUrl);
							}
						})
						let body={
							name: vm.form.activityName,   // 必须要的
							category: 2,        //只能是1和2
							start_time: vm.timeDateMinutes(vm.form.activityStartTime),        
							end_time: vm.timeDateMinutes(vm.form.activityEndTime),        
							backgroundImg: vm.form.backgroundImg,  //阿里云图片路径 
							model_id: vm.form.model_id,        
							template_id: vm.form.tplModelId,  //必须要
							description: vm.form.activityRules,
							style_rule:{
								backgroundImg: vm.form.backgroundImg,  //阿里云图片路径 ,
								banner:bannerImgList,  //banner图片
								// defaultBanner:vm.defaultBanner
							},
							limits:{
								type:vm.form.tagDetailValue,     //一天或者全程
								num:vm.form.lotteryNum        //参与次数
							},
						};
						//保存内容设置
						api.activityContent(body).then(res=>{
							// vm.contentLoading=false;
							if(res.data.code==200){
								vm.isTabContentShow=true;
								vm.activityNo=res.data.data.id;
								vm.currentTab++;
							}
						}).catch(err=>{
							vm.httpStatusCode(err);
						})  
					}
				}else{
					// if(vm.currentTab==1&&!vm.isTabListShow){
						
							
					// }else{
					// 	if(vm.currentTab==vm.tabData.length-1){
					// 			if(vm.contentSetReg()&&vm.prizeSetReg()&&vm.appSetReg()&&vm.wxSetReg()){
					// 				let body={
					// 				name: vm.form.activityName,   // 必须要的
					// 				category: 2,        //只能是1和2
					// 				start_time: vm.timeDateMinutes(vm.form.activityStartTime),        
					// 				end_time: vm.timeDateMinutes(vm.form.activityEndTime),        
					// 				backgroundImg: vm.form.backgroundImg,  //阿里云图片路径 
					// 				model_id: "模型id",        
					// 				template_id: vm.form.tplModelId,  //必须要
					// 				description: vm.form.activityRules,
					// 				limits:{
					// 					type:vm.form.tagDetailValue,     //一天或者全程
					// 					num:vm.form.lotteryNum        //参与次数
					// 				},
					// 			};
					// 			//保存所有数据
					// 		}
							
					// 		console.log('保存所有')
					if(vm.currentTab!=vm.tabData.length-1){
						vm.currentTab++;
					}else{
						if(vm.contentSetReg()&&vm.prizeSetReg()&&vm.appSetReg()&&vm.wxSetReg()){
							vm.postActivityCommon();  //保存所有信息
						};
					}
				}		
			},
			//保存所有信息
			postActivityCommon(){
				let vm = this;
				vm.fetchLoading=true;
				let shareIsOpen;   //发布到微信分享 
				vm.form.shareSwitch?shareIsOpen='on':shareIsOpen='off';
				if(!vm.form.backgroundImg){
					vm.form.backgroundImg=vm.form.bgImg;
				}
				let bannerImgList=[];
				vm.form.bannerImg.forEach((item,index)=>{
					if(item.imgUrl){
						bannerImgList.push(item.imgUrl);
					}
				})
				let body={
					name: vm.form.activityName,   // 必须要的
					category: 2,        //只能是1和2
					start_time: vm.timeDateMinutes(vm.form.activityStartTime),        
					end_time: vm.timeDateMinutes(vm.form.activityEndTime),        
					backgroundImg: vm.form.backgroundImg,  //阿里云图片路径 
					model_id: vm.form.model_id,        
					template_id: vm.form.tplModelId,  //必须要
					description: vm.form.activityRules,
					style_rule:{
						backgroundImg: vm.form.backgroundImg,  //阿里云图片路径 ,
						banner:bannerImgList,  //banner图片
					},
					limits:{
						type:vm.form.tagDetailValue,     //一天或者全程
						num:vm.form.lotteryNum        //参与次数
					},
					//发布到微信 
					shares:{
						isopen:shareIsOpen,
						title:vm.form.shareTitle,
						content:vm.form.shareContent,
						thumb:vm.form.shareIcon
					}, 
					list_background_img:vm.form.listThumbnailIcon, //  列表配置
					customId: vm.form.activityInfoId,// 自定义id
					organizer: vm.form.organizerInfo,//   组织方
					remark:  vm.form.activityInfoNote,//   备注
					others:  vm.form.activityInfoRests //    其他
				};
				// console.log(body);
				api.activityCommonUpdate(vm.activityNo,body).then(res=>{
					if(res.data.code==200){
						//保存奖品
						if(vm.prizeSetReg()){
							vm.postPrizeSet();//保存奖品
						}
						
					}
				}).catch(function (err) {
					vm.fetchLoading=false;
                    vm.httpStatusCode(err);
					vm.$router.push({name:'activityList'});
				});
			},
			//保存奖品设置
			postPrizeSet(){
				let vm = this;
				// let body=[];
				// console.log(vm.postNum);
				if(vm.postNum>=1){
					let item=vm.pickedPrizeList[vm.postNum-1];
					let data={};
					data.available=parseInt(item.stock_number)-parseInt(item.winningLimit); //剩余数量
					data.img=item.background_image; //奖品图片
					data.max_amount='';
					data.prize={
						available:parseInt(item.stock_number)-parseInt(item.winningLimit),//剩余数量
						background_image:item.background_image, //奖品图片
						id:item.id, //奖品id
						name:item.name //奖品名称
					};
					data.prize_id=item.id; //奖品id
					data.stock_limit=item.numLimit; //库存设置
					data.winning_limit=item.winningLimit; //中奖设置
					data.winning_probability=parseInt(item.probabLimit)/100 //中奖率
					// body.push(data);
					api.postPrizeNew1(vm.activityNo,data).then(res=>{
						if(res.data.code==200){
							vm.postNum--;
							if(vm.postNum<1){
								vm.postActivityPublishing();//保存活动拉新设置	
							}else{
								vm.postPrizeSet();  //自调
							}
						}
					}).catch(err=>{
						vm.fetchLoading=false;
						vm.httpStatusCode(err);
					})  
				}
			},

			//保存活动拉新设置  activityPublishing
			postActivityPublishing(){
				let vm = this;
				let wechatIsOpen; //是否开启微信分享
				let qr_code=[];
				if(vm.form.implantWechat){
					wechatIsOpen='on';
					qr_code.push(vm.form.wxCodeShow);
				}else{
					wechatIsOpen='off';
					qr_code=[];
				};
				let implantAppIsOpen;//是否开启app分享
				let app_urls=[];
				if(vm.form.implantApp){
					implantAppIsOpen='on';
					app_urls.push(vm.form.appDownloadUrl);
				}else{
					implantAppIsOpen='off';
					app_urls=[];
				};
				let body={
						app:{
							is_open:implantAppIsOpen,
							app_urls:app_urls
						},
						wechat:{
							is_open:wechatIsOpen,
							qr_code:qr_code
						}
					};

				api.activityPublishing(vm.activityNo,body).then(res=>{
					vm.fetchLoading=false;
					if(res.data.code==200){
						vm.$router.push({name:'activityList'});
						// vm.postActivityCommon();//保存所有信息
					}
				}).catch(function (err) {
					vm.fetchLoading=false;
                    vm.httpStatusCode(err);
					vm.$router.push({name:'activityList'});
				});
			},
		
			//内容设置验证
			contentSetReg(){
				let num = /^\+?[1-9][0-9]*$/;　
				if(this.form.activityName==''){
					this.$message({showClose: true,message: '活动名称不能为空'});
					return false;
				}else if(this.form.activityStartTime==''){
					this.$message({showClose: true,message: '请选择活动开始时间'});
					return false;
				}else if(this.form.activityEndTime==''){
					this.$message({showClose: true,message: '请选择活动结束时间'});
					return false;
				}else if(this.form.lotteryNum==''||this.form.lotteryNum<=0||!num.test(this.form.lotteryNum)){
					this.$message({showClose: true,message: '抽奖次数必须是大于0的整数'});
					return false;
				}else{
					return true;
				}
			},
			//奖品设置验证
			prizeSetReg(){
				let vm = this;
				let num = /^\+?[1-9][0-9]*$/;　
				let flag;
				if(vm.pickedPrizeList.length!=0){
					let prizeLimitNum=0;
					vm.pickedPrizeList.forEach((item,index)=>{
						if((item.winningLimit>item.numLimit||item.winningLimit<=0)||!num.test(item.winningLimit)){
							this.$message({showClose: true,message: item.name+'中奖限制不能大于数量限制且为大于1的整数'});
							return flag=false;
						}else if((item.numLimit>item.stock_number||item.numLimit<=0)||!num.test(item.numLimit)){
							this.$message({showClose: true,message: item.name+'数量限制不能大于库存且为大于1的整数'});
							return flag=false;
						}else if(item.probabLimit>100||item.probabLimit<=0){
							this.$message({showClose: true,message: item.name+'中奖概率不能大于100%且不能小于1%'});
							return flag=false;
						}else{
							flag=true;
						}
						prizeLimitNum+=parseFloat(item.probabLimit);
					});
					console.log(prizeLimitNum);
					if(prizeLimitNum>100){
						this.$message({showClose: true,message: vm.pickedPrizeList.length+'个奖品的中奖概率之和不能大于100%'});
						return flag=false;
					}
				}else{					
					this.$message({showClose: true,message:'奖品列表不能为空'});
					flag=false;
				}
				return flag;
			},
			//开通app验证
			appSetReg(){
				let vm = this;
				let reg=/^(https|http|ftp|rtsp|mms):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?$/;
				if(vm.form.implantApp){
					if(vm.form.appDownloadUrl==''||!reg.test(vm.form.appDownloadUrl)){
						this.$message({showClose: true,message: '请输入正确的APP下载链接'});
						return false;
					}else if(vm.form.listThumbnailIcon==''){
						this.$message({showClose: true,message: '列表缩略图不能为空'});
						return false;
					}else{
						return true;
					}
				}else{
					return true;
				}
			},
			
			//微信分享验证
			wxSetReg(){
				let vm = this;
				if(vm.form.shareSwitch){
					if(vm.form.shareIcon==''){
						this.$message({showClose: true,message: '分享图片不能为空'});
						return false;
					}else if(vm.form.shareTitle==''){
						this.$message({showClose: true,message: '分享标题不能为空'});
						return false;
					}else if(vm.form.shareContent==''){
						this.$message({showClose: true,message: '分享文案不能为空'});
						return false;
					}else{
						return true;
					}
				}else{
					return true;
				}
			},


			//获得奖品列表
			getAvailable(val=""){
				let vm = this;
				let body={ 
					per_page:vm.availableForm.per_page,
					page:vm.availableForm.page,   
					q:val
				};
				api.fetchAvailable(body).then(res=>{
					vm.prizeList=res.data.data.data;
					vm.availableForm.total=res.data.data.total;
					vm.availableForm.page=res.data.data.current_page;
					vm.availableForm.last_page=res.data.data.last_page;
				}).catch(err=>{
                    vm.httpStatusCode(err);
                }) ;
			},
			//搜索奖品列表
			searchPriceList(){
				this.getAvailable(this.availableForm.q);//获得奖品列表
			},
			//奖品分页
			pagePriceList(val){
				if(val==1&&this.availableForm.page>1){
					this.availableForm.page--;
					this.getAvailable(this.availableForm.q);//获得奖品列表
				}else if(val==2&&(this.availableForm.page>1&&this.availableForm.page<this.availableForm.last_page)){
					this.availableForm.page++;
					this.getAvailable(this.availableForm.q);//获得奖品列表
				}
			},
		    onEditorReady(editor) {
		        console.log('editor ready!', editor)
		    },
			//切换tab
		    tabClickEvent(index){
				if(this.isTabContentShow){
					this.currentTab = index;
				}else{
					this.currentTab = 0;
					this.$message({
			          showClose: true,
			          message: '请先保存内容设置'
			        });
				}
				
			},
			addSpecialRule(){
				var prizeLength = this.pickedPrizeList.length;
				if (prizeLength === 0) {
					this.$message({
			          showClose: true,
			          message: '请先添加奖品,然后再设置特殊规则'
			        });
				} else {
					var obj = {
						startTime: '',
						endTime: '',
						prizeOptionValue: 0,
						prizeNum: '0'
					}
					this.specialRuleData.push(obj);
				}
			},
			deleteSpecialRule(item,index){
				Vue.delete(this.specialRuleData, index);
			},
			showAddPrizeToast(){
				this.addPrizeBox = true;
			},
			hideAddPrizeToast(){
				this.addPrizeBox = false;
			},
			pickPrize(item,num){
				// if(item.availables<=0){
				// 	Message.error({
				// 		showClose: true,
				// 		message: '该奖品库存不足'
				// 	})	
				// }else{
					this.addPrizeBox = false;
					item.winningLimit=1;
					item.numLimit=1;
					item.probabLimit=1;
					this.$set(item,'winInform',false);
					this.pickedPrizeList.push(item);
					var index = this.prizeOptions.length;
					var obj = {
						value: index,
						label: item.name
					};
					this.prizeOptions.push(obj);
					Vue.delete(this.prizeList, num);   //删除prizeList中已经选取的
				// }

			},
			//删除选择的奖品
			deletePickedPrize(item,index){
				this.prizeList.push(item);
				Vue.delete(this.pickedPrizeList, index);
			},
			//奖品设置规则
			changeLimitInput(val,item){
				let reg = /^(?:0|[1-9][0-9]?|100)$/;
				let num = /^\+?[1-9][0-9]*$/;　
				if(val==1){
					if(!num.test(item.winningLimit)||item.winningLimit<1){
						Message.error({
							showClose: true,
							message: '请输入大于0的整数'
						})
					}else if(parseInt(item.winningLimit)>parseInt(item.numLimit)){
						Message.error({
							showClose: true,
							message: '中奖限制不能大于数量限制'
						})
					}
				}else if(val==2){
					if(!num.test(item.numLimit)||item.numLimit<1){
						Message.error({
							showClose: true,
							message: '请输入大于0的整数'
						})
					}else if(parseInt(item.numLimit)>parseInt(item.stock_number)){
						Message.error({
							showClose: true,
							message: '数量限制不能大于'+item.stock_number
						})
					}else if(parseInt(item.winningLimit)>parseInt(item.numLimit)){
						Message.error({
							showClose: true,
							message: '中奖限制不能大于数量限制'
						})
					}
				}else if(val==3){
					if(!reg.test(item.probabLimit)){
						Message.error({
							showClose: true,
							message: '请输入0~100之间的整数'
						})
					}
				}
			},
			//打开上传图片弹出框
			showUploadPicToast(val,index){
				this.clickUpLoadImg=val;
				if(val==0){
					this.bannerImgClickIndex=index;
				}
				this.uploadPicBox = true;
			},
			//隐藏上传图片弹出框
			hideUploadPicToast(){
				this.uploadPicBox = false;
				this.currentBannerIndex = -1;
			},
			//选择服务器返回的图片
			chooseBannerImg(index){
				this.currentBannerIndex = index;
			},
			//确认上传图片
			comfirmBannerImg(){
				var curIndex = this.currentBannerIndex;
				if (curIndex === -1) {
					this.$message({
			          showClose: true,
			          message: '请先选择图片'
			        });
				} else if (this.clickUpLoadImg === 0) {
					//banner图片
					this.form.bannerImg[this.bannerImgClickIndex].imgUrl = this.uploadPicList[curIndex].src;
					this.hideUploadPicToast();
				} else if (this.clickUpLoadImg === 1) {
					//二维码图片
					this.form.wxCodeShow = this.uploadPicList[curIndex].src;
					this.hideUploadPicToast();
				}else if (this.clickUpLoadImg === 2) {
					//分享的图片
					this.form.shareIcon = this.uploadPicList[curIndex].src;
					this.hideUploadPicToast();
				}else if (this.clickUpLoadImg === 3) {
					//背景图
					this.form.backgroundImg = this.uploadPicList[curIndex].src;
					this.hideUploadPicToast();
				}
			},
			//删除选择的图片
			cancelBanner(value,index){
				if (value === 0) {
					Vue.delete(this.form.bannerImg, index);
				} else if(value === 1){
					this.form.wxCodeShow = '';
				}else if(value === 2){
					this.form.shareIcon = '';
				}else if(value === 3){
					this.form.bgImg = baseImgPath+this.$route.query.background;
					this.form.backgroundImg = '';
				}else if(value === 4){
					this.form.listThumbnailIcon = '';  //列表缩略图
				}
			},

			//上传图片
			addImgEvent(event){
				var that = this;
				that.imgUpLoading=true;
				that.imgUpLoadingText='上传中';
	            var img1 = event.target.files[0];
	            //生成临时图片路径
                var temSrc = URL.createObjectURL(img1);
                //判断图片尺寸大小
	            var size = img1.size/1024;
	            //小于200k
				if(that.clickUpLoadImg==3){
					if(size>300){
						that.imgUpLoading=false;
						that.$message({
						showClose: true,
						type: 'error',
						message: '图片大小不能大于200KB'
						}); 
						return false;  
					}
				}else{
					if(size>200){
						that.imgUpLoading=false;
						that.$message({
						showClose: true,
						type: 'error',
						message: '图片大小不能大于200KB'
						}); 
						return false;  
					}
				}
	            
	            //判断图片像素尺寸
        		var _img = new Image();
        		_img.onload = function  () {
        			var imgWidth = _img.width,
        				imgHeight = _img.height;
        			if (that.clickUpLoadImg === 0) {
	        			if (imgWidth/imgHeight!=2) {
							that.imgUpLoading=false;
		            		that.$message({
		                      showClose: true,
		                      type: 'error',
		                      message: '请上传宽高2:1的图片'
		                    }); 
			                return false;
	        			};
				        // that.form.bannerImg = temSrc;
						//上传图片
						let formdata = new FormData();
				        formdata.append('upfile', img1);
				        api.uploadPrizeImg(formdata).then(res => {
							that.$message({
								message: '上传成功',
								type: 'success'
							});
							that.hideUploadPicToast();
							that.imgUpLoading=false;
				        	that.form.bannerImg[that.bannerImgClickIndex].imgUrl = res.data.result;
				        }).catch(err=>{
							that.httpStatusCode(err);
						})  
        			} else if(that.clickUpLoadImg===1){
						if (imgWidth!=imgHeight) {
							that.imgUpLoading=false;
		            		that.$message({
		                      showClose: true,
		                      type: 'error',
		                      message: '请上传比例为1:1的图片'
		                    }); 
			                return false;
	        			};
				        // that.form.wxCodeShow = temSrc;
						//上传图片
						let formdata = new FormData();
				        formdata.append('upfile', img1);
				        api.uploadPrizeImg(formdata).then(res => {
							that.$message({
								message: '上传成功',
								type: 'success'
							});
							that.hideUploadPicToast();
							that.imgUpLoading=false;
				        	that.form.wxCodeShow = res.data.result;
				        }).catch(err=>{
							that.httpStatusCode(err);
							that.hideUploadPicToast();
							that.imgUpLoading=false;
						})  
					}else if(that.clickUpLoadImg===2){
						
        				if (imgWidth!=imgHeight) {
							that.imgUpLoading=false;
		            		that.$message({
		                      showClose: true,
		                      type: 'error',
		                      message: '请上传比例为1:1的图片'
		                    }); 
			                return false;
	        			};
				        // that.form.shareIcon = temSrc;
						//上传图片
						let formdata = new FormData();
				        formdata.append('upfile', img1);
				        api.uploadPrizeImg(formdata).then(res => {
							that.$message({
								message: '上传成功',
								type: 'success'
							});
							that.hideUploadPicToast();
							that.imgUpLoading=false;
				        	that.form.shareIcon = res.data.result;
				        }).catch(err=>{
							that.httpStatusCode(err);
							that.hideUploadPicToast();
							that.imgUpLoading=false;
						})  
        			}else if(that.clickUpLoadImg===3){
						//上传背景图
        				if (imgWidth!=640 || imgHeight!=1200) {
							that.imgUpLoading=false;
		            		that.$message({
		                      showClose: true,
		                      type: 'error',
		                      message: '请上传尺寸为640*1200的图片'
		                    }); 
			                return false;
	        			};
						//上传图片
						let formdata = new FormData();
				        formdata.append('upfile', img1);
				        api.uploadPrizeImg(formdata).then(res => {
							that.$message({
								message: '上传成功',
								type: 'success'
							});
							that.hideUploadPicToast();
							that.imgUpLoading=false;
				        	that.form.backgroundImg = res.data.result;
							that.form.bgImg = res.data.result;
				        }).catch(err=>{
							that.httpStatusCode(err);
							that.hideUploadPicToast();
							that.imgUpLoading=false;
						})  
        			}else if(that.clickUpLoadImg===4){
						//列表缩略图

        				// if (imgWidth!=640 || imgHeight!=1200) {
		            	// 	that.$message({
		                //       showClose: true,
		                //       type: 'error',
		                //       message: '请上传尺寸为640*1200的图片'
		                //     }); 
			            //     return false;
	        			// };

						//上传图片
						let formdata = new FormData();
				        formdata.append('upfile', img1);
				        api.uploadPrizeImg(formdata).then(res => {
							that.$message({
								message: '上传成功',
								type: 'success'
							});
							that.hideUploadPicToast();
							that.imgUpLoading=false;
				        	that.form.listThumbnailIcon = res.data.result;
				        }).catch(err=>{
							that.httpStatusCode(err);
							that.hideUploadPicToast();
							that.imgUpLoading=false;
						})  
        			}
        			
			        
					setTimeout(function  () {
			        	URL.revokeObjectURL(temSrc);
			        },100);
        		}
        		_img.src = temSrc;
			},
			//开启分享到微信
			openImplantWx(val){
				if(!this.isWXAppId){
					this.form.implantWechat=false;
					this.dialogVisible=true;  //打开绑定微信appid
				}
			},
			//判断是否绑定微信appid
			getIsWXAppId(){
				let vm = this;
				api.isWechatId().then(res=>{
					res.data.data.length==0?vm.isWXAppId=false:vm.isWXAppId=true
				}).catch(err=>{
                    vm.httpStatusCode(err);
                });
			},
			handleClose() {
				let vm = this;
				api.postWxAppId(vm.wxForm).then(res=>{
					if(res.data.code==200){
						vm.$message({
							message: '绑定成功',
							type: 'success'
						});
						vm.dialogVisible = false;
						vm.getIsWXAppId(); 

					}
				}).catch(err=>{
                    vm.httpStatusCode(err);
                })  
			},
			//自定义添加属性
			customChange(a){
				if(a=='Banner图'){
					this.form.bannerImg=[];
				}
			},
			//添加banner图片
			addBannerImg(){
				if(this.form.bannerImg.length<5){
					this.form.bannerImg.push( {imgUrl:''} )
				}else{
					this.$message({
						message: '只能添加五张banner'});
				}
			},
			//奖品分页
            selectPrize(a){
                this.availableForm.page=a;
				this.getAvailable();
            },

			//上传图片分页 点击当前的页数
            pageChange(a){
                this.updateImgcurrent_page=a;
            },
        },
		beforeRouteEnter:function(to,from,next) {    //路由生命周期
			next(vm => {
				if(vm.$route.query.tplModelId){
					vm.form.bgImg=baseImgPath+vm.$route.query.background;
					vm.form.tplModelId=vm.$route.query.tplModelId;
					vm.form.model_id=vm.$route.query.model_id;
					if(vm.$route.query.bannerImg){
						vm.defaultBanner=baseImgPath+vm.$route.query.bannerImg;   //默认的banner图
					}else{
						vm.defaultBanner='';
					}
				}else{
					vm.$router.go(-1);
				}
			})
		},
	}
</script>
<style>
	/* 修改输入框样式 */
	.pick-date-box .el-input__inner{
		height: 34px;
		box-sizing: border-box;
		border-radius: 0;
		background-color: #f4f8fb;
	    color: #888;
	    border: 1px solid #efefef;
	    box-shadow: none;
	    font-size: 12px;
	    width: 100%;
        height: 34px;
        padding: 6px 12px;
        box-sizing: border-box;
	}
	.special-item .el-input__inner{
		height: 32px;
		box-sizing: border-box;
		border-radius: 0;
		background-color: #f4f8fb;
	    color: #888;
	    border: 1px solid #efefef;
	    box-shadow: none;
	    font-size: 12px;
	    width: 109px;
        padding: 6px 12px;
        box-sizing: border-box;
	}
	.special-item .el-date-editor i{
		display: none;
	}
	.special-item .el-select .el-input__inner{
		padding-right: 25px;
		width:130px;
	}
	.lotteryNum-box .el-input__inner{
		width:142px;
		box-sizing: border-box;
		border-radius: 0;
		height: 34px;
		font-size: 12px;
	    color: rgb(136, 136, 136);
	    border-color: rgb(239, 239, 239);
	    background-color: rgb(238, 238, 238);
	}
	.tag-box .el-input__inner{
		width:160px;
	}
	.tag-box .el-input{
	}
	.rule-box .ql-container{
		height: 300px;
		background: #f4f8fb;
	}
	.share-switch .el-switch{
		position: relative;
		top:-1px;
	}
	.rule-title .el-switch{
		top:-1px;
		left: 10px;
	}
	.el-switch__label span{
		color:rgba(0,0,0,0);
	}
	#add-prize-box .el-input {
	    width: 260px;
	}
</style>
<style lang="less" scoped>
	@import '../style/setTemplate';

</style>